## 1
def my_add(n):
    ''''求前n项和’'''
    target=0
    for i in range(1,n+1):
        target=target+i
    print(target)

## 2
def my_sum(a,b):
    target=0
    for i in range(a,b+1):
        target=target+i
    print("(a,b)的值是：",target)

## 3
def my_trans(str):
    print(str.title())
str="i love python"


## 4
my_list=[1,2,3,4,5]
def square(num):
    return num*num
print(list(map(square,my_list)))


## 5
def n_dict(my_dict,n):
    for i in my_dict:
        my_dict[i]=n*my_dict[i]
    print(my_dict)




## 6
def swap(x,y):
    print("交换前：",x,y)
    t=y
    y=x
    x=t
    print("交换后：",x,y)


## 7
def average():
    total=0
    count=0
    av_sum=[]
    n=int(input("请输入你需要求和的数字个数>>:"))
    if n==0:
        return None
    while count<n :
        av_sum.append(int(input()))
        count=count+1
    print("平均值是：",sum(av_sum)/len(av_sum))


## 8
def concatenate():
    n=int(input("请输入你要拼接的字符串个数>>:"))
    if n==0 :
        return None
    count=0
    str_con=[]
    while count<n :
        str_con.append(input())
        count=count+1
    str_con=''.join(str_con)
    print(str_con)


## 9
def combine_dict():
    n = int(input("请输入你要拼接的字典个数>>:"))
    if n == 0:
        return None
    dict3={}
    dict1={'a':10,'b':20,'c':30}
    dict2={'a':15,'d':40,'e':50}
    dict3=dict(dict1,**dict2)
    print(dict3)
combine_dict()
